<template>
  <footer class="footer-bar">
    <div class="footer-content">
      <div class="footer-text">© 2025 BUO宠物生活馆. All rights reserved.</div>
      <div class="footer-icons">
        <div
          class="icon-item"
          @mouseenter="showQR('weibo')"
          @mouseleave="hideQR"
        >
          <img src="../assets/image/weibo.svg" alt="微博" />
          <div v-if="qrType === 'weibo'" class="qr-pop">
            <img src="../assets/image/WeiBo.jpg" alt="微博二维码" />
            <span>微博二维码</span>
          </div>
        </div>
        <div
          class="icon-item"
          @mouseenter="showQR('wechat')"
          @mouseleave="hideQR"
        >
          <img src="../assets/image/wechat.svg" alt="微信" />
          <div v-if="qrType === 'wechat'" class="qr-pop">
            <img src="../assets/image/WeChat.jpg" alt="微信二维码" />
            <span>微信公众号</span>
          </div>
        </div>
        <div class="icon-item" @mouseenter="showQR('qq')" @mouseleave="hideQR">
          <img src="../assets/image/QQ.svg" alt="QQ" />
          <div v-if="qrType === 'qq'" class="qr-pop">
            <img src="../assets/image/QQ.jpg" alt="QQ二维码" />
            <span>QQ二维码</span>
          </div>
        </div>
      </div>
    </div>
  </footer>
</template>

<script setup>
import { ref } from "vue";
const qrType = ref("");
const showQR = (type) => {
  qrType.value = type;
};
const hideQR = () => {
  qrType.value = "";
};
</script>

<style lang="less" scoped>
.footer-bar {
  width: 100%;
  background: #232b36;
  color: #fff;
  padding: 24px 0 18px 0;
  text-align: center;
  border-top: 2px solid #e0e0e0;
  min-height: 120px;
}
.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 15px;
}
.footer-text {
  color: #fff9c4;
  font-size: 1rem;
  margin-bottom: 8px;
  letter-spacing: 1px;
}
.footer-icons {
  display: flex;
  gap: 32px;
  justify-content: center;
  align-items: center;
}
.icon-item {
  position: relative;
  display: inline-block;
  cursor: pointer;
  img {
    width: 32px;
    height: 32px;
    filter: grayscale(0.7);
    transition: filter 0.2s, transform 0.2s;
  }
  &:hover img {
    filter: grayscale(0) drop-shadow(0 2px 8px #8d26e6aa);
    transform: scale(1.08);
  }
}
.qr-pop {
  position: absolute;
  left: 50%;
  top: -140px;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(140, 38, 230, 0.13);
  padding: 12px 16px 8px 16px;
  z-index: 10;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.2s;
  img {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    margin-bottom: 6px;
    box-shadow: 0 2px 8px #e0e0e0;
  }
  span {
    color: #8d26e6;
    font-size: 0.95rem;
    margin-top: 2px;
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}
@media (max-width: 600px) {
  .footer-content {
    gap: 8px;
  }
  .footer-icons {
    gap: 18px;
  }
  .qr-pop {
    left: 50%;
    top: -120px;
    min-width: 90px;
    padding: 8px 8px 6px 8px;
    img {
      width: 64px;
      height: 64px;
    }
  }
}
</style>
